ModEditor.GUI.BasicControl = {}

function ModEditor.GUI.BasicControl:Draw()
	if self.UseBorder then
		if self.MouseOver then
			set_color(0.5,0.5,0.5,1)
		else
			set_color(0,0,0,1)
		end
		draw_quad(self.Parent.X+self.X-2,self.Parent.Y+self.Y-2,self.Width+4,self.Height+4)
		set_color(1,1,1,1)
		draw_quad(self.Parent.X+self.X,self.Parent.Y+self.Y,self.Width,self.Height)
	end
	if self.DrawEverything ~= nil then
		self:DrawEverything(self.Parent.X+self.X,self.Parent.Y+self.Y)
	end
end
function ModEditor.GUI.BasicControl:InControl(x,y)
	return (x > self.X) and (x < self.X+self.Width) and (y > self.Y) and (y < self.Y+self.Height)
end
function ModEditor.GUI.BasicControl:Init()
	self.X,self.Y = 0,0
	self.Width,self.Height = 10,10
	self.UseBorder = true
	self.MouseOver = false
end
function ModEditor.GUI.BasicControl:Apply(parameters)
	for i=1,#parameters do
		self[parameters[i][1]]=parameters[i][2]
	end
end
function ModEditor.GUI.BasicControl:MouseScrollDown()
end
function ModEditor.GUI.BasicControl:MouseScrollUp()
end
function ModEditor.GUI.BasicControl:MousePositionChange(incontrol)
	self.MouseOver = incontrol
end
function ModEditor.GUI.BasicControl:New(parent)
	local obj = {}
	----------------------
	obj.Init = self.Init
	obj.Draw = self.Draw
	obj.InControl = self.InControl
	obj.Apply = self.Apply
	obj.MouseScrollDown = self.MouseScrollDown
	obj.MouseScrollUp = self.MouseScrollUp
	obj.MousePositionChange = self.MousePositionChange
	obj.AlwaysVisible = false
	----------------------
	parent:AddControl(obj)
	obj.Parent = parent
	obj:Init()
	return obj
end
